﻿@page "/validate"

<ValidateForm Model="Dto" @ref="ValidateForm" ValidateAllProperties="true">
    <div>姓名:<BootstrapInput ShowLabel="false" @bind-Value="Dto!.Name" /></div>
    <div>年龄:<BootstrapInput ShowLabel="false" @bind-Value="Dto!.Age" /></div>
    <div>状态:<NullCheckbox TValue="bool?" @bind-Value="Dto!.IsStudying" /></div>
    <div>是:<Checkbox ShowLabel="false" @bind-Value="Dto!.IsChina" /></div>
    
    @* <div>国家: <Country @bind-Value="Dto!.Country" /></div> *@
    @* <div>hh:<Validate2 @bind-Value="Dto!.Country" /></div> *@
    <div>salport:<BootstrapBlazorApp.OnlyServer.Pages.Main.Components.Salport @bind-Value="Dto!.Country" /></div>
    <div>Atuo:<AutoComplete @bind-Value="Dto!.Province" /></div>
</ValidateForm>


<Button Text="保存" OnClick="OnClick"/>


@code 
{
    public Student? Dto { get; set; }

    ValidateForm? ValidateForm;

    protected override void OnInitialized()
    {
        Dto = new();
    }

    Task OnClick()
    {
        ValidateForm!.Validate();
        return Task.CompletedTask;
    }
}
